package com.company.http;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class HttpRequest {

    String header;

    //-----------------------constructor---------------------------------------------

    HttpRequest(InputStream in) throws IOException {
        initialize();
    }

    //-----------------------private methods-----------------------------------------

    private void initialize() throws IOException {
        header = readHeader();
	}

    private String readHeader() throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        StringBuilder builder = new StringBuilder();
        String ln;
        while(true) {
            ln = reader.readLine();
            if (ln == null || ln.isEmpty()) {
                break;
            }
            builder.append(ln + System.getProperty("line.separator"));
        }
        return builder.toString();
    }

    //-----------------------public methods------------------------------------------

    public String getMethod() {
        return "Not";
    }

    public String getHeader(String name) {
        return header;
    }

}